package org.xxpay.pay.channel.zhuming;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.stereotype.Component;
import org.springframework.util.Assert;
import org.xxpay.common.unify.AbstractPaymentConfig;

@Component
@Data
@ToString
@NoArgsConstructor
public class ZhumingConfig extends AbstractPaymentConfig {
    public static final String CHANNEL_NAME = "zhuming";
    public static final String CHANMEL_NAME_ALI_QR = CHANNEL_NAME + "_ali_qr";

    ZhumingConfig(String payParam){
        Assert.notNull(payParam, "init quanmin config error");
        JSONObject object = JSON.parseObject(payParam);
        setAppId(object.getString("appId"));
        setPayMode(object.getString("payType"));
        setPrivateKey(object.getString("privateKey"));
        setPublicKey(object.getString("publicKey"));
        setRequestUrl(object.getString("requestUrl"));
    }
}
